#ifndef LISTENTHREAD_H
#define LISTENTHREAD_H

#include <QThread>
#include "socktooler.h"
#include "msgthread.h"
#include "string"
#include "chatdbhandler.h"
#include "signalrepeater.h"
#include <iostream>
#include "heartbtimer.h"
#include <time.h>
#include <cmath>
using namespace std;

struct TransStruct{
//    SOCKET *rec;
//    SOCKET *sock1;
//    MsgThread *msgthread;
    string name;
    long time;
};

class ListenThread : public QThread{
    Q_OBJECT
public:
    ListenThread(ChatDbHandler *db);
    void run();
    ChatDbHandler *chatdb;
//    void ModifyUserTime()
signals:
    void SendUserAliveList(string content);
private slots:
    void freshTransStruct(const TransMsg &trans_msg);
    void DealUserState();
    void PushTotalUser(string name);

private :
    HeartBTimer hb_timer;
    vector<TransStruct> total_user;

};
#endif // LISTENTHREAD_H
